import Service from './$axios'
import { lotAuth, lotAuth2 } from '../config'
//登录
export const login = (name,password) => {    
    return Service({
        url: '/zuul/login?account='+name+'&password='+password,
		method: 'post'
    })
}
//登出
export const loginOut = () => { 
    return Service({
        url: '/zuul/logout',
		method: 'post'
    })
}
//根据id获取用户
export const queryUserById = (id) => {    
    return Service({
        url: lotAuth + '//user/queryUserById?userId='+id,
		method: 'get'
    })
}
//获取菜单
export const getMenus = (str) => {     
    return Service({
        url: lotAuth + '/menu/queryTreeMenu?type=' + str,
        method: 'get',
    })
}
//添加 修改 菜单
export const addMenu = (data) => { 
    return Service({
        url: lotAuth + '/menu/addMenu',
        method: 'post',
        data:data,
    })
}

//删除菜单
export const deleteMenu = (id) => {     
    return Service({
        url: lotAuth + '/menu/deleteMenu/'+id,
        method: 'delete'
    })
}
//修改密码
export const updatePss = (data) => {
        
    return Service({
              	url: lotAuth + '/user/updatePss',
                method: 'post',
                data:data,
    })
}

//根据id获取菜单
export const getMenuById = (id) => {
    return Service({
        url: lotAuth + '/menu/queryMenuParentById/'+id,
        method: 'get'
    })
}

//新增 修改 按钮
export const addOrUpdateBtn = (data) => {
    return Service({
        url: lotAuth + '/button/addButton',
        method: 'post',
        data:data
    })
}

//根据菜单id查询按钮
export const getBtnByMenuId = (id) => {
    return Service({
        url: lotAuth + '/button/queryButton/'+id,
        method: 'get'
    })
}
//删除按钮
export const deleteBtnById = (id) => {
    return Service({
        url: lotAuth + '/button/deleteButton/'+id,
        method: 'delete'
    })
}

// //获取部门
// export const getDepartMents = () => {
//     return Service({
//         url: lotAuth + '/department/queryTreeDepartment',
//         method: 'get',
//     })
// }
//获取部门
export const getDepartMents = () => {
    return Service({
        url: lotAuth2 + '/department/queryTreeDepartment',
        method: 'get',
    })
}

//添加 修改 部门
export const addDepartMent = (data) => {
    return Service({
        url: lotAuth + '/department/addDepartment',
        method: 'post',
        data:data,
    })
}

//删除部门
export const deleteDepartMent = (id) => {
    return Service({
        url: lotAuth + '/department/deleteDepartment/'+id,
        method: 'delete'
    })
}

//获取角色
export const getRoles = () => {   
    return Service({
        // url: lotAuth + '/role/queryPageRole?pageNum=1&pageSize=9999',
        url: lotAuth2 + '/role/queryPageRole?pageNum=1&pageSize=9999',
        method: 'get',
    })
}

//添加 修改 部门
export const addOrUpdateRole = (data) => {
    return Service({
        url: lotAuth + '/role/addRole',
        method: 'post',
        data:data,
    })
}

//删除角色
export const deleteRole = (id) => {
    return Service({
        url: lotAuth + '/role/deleteRole/'+id,
        method: 'delete'
    })
}



//根据角色id查询拥有权限
export const queryRoleMenuList = (id,type) => {
    return Service({
        url: lotAuth + '/role/queryRoleMenuList?roleId='+id+'&type='+type,
        method: 'get'
    })
}
//权限配置
export const authorityDeploy = (data) => {
    return Service({
        url: lotAuth + '/role/authorityDeploy',
        method: 'post',
        data:data,
    })
}
//查询所有用户
export const getUsers = (str) => {
    return Service({
              	url: lotAuth2 + '/user/queryPageUser?'+str,
                method: 'get',
    })
}


//添加 修改 用户
export const addOrUpdateUser = (data) => {    
    return Service({
        url: lotAuth + '/user/addUser',
        method: 'post',
        data:data,
    })
}

//角色分配
export const roleAssignment = (data) => {
    return Service({
        url: lotAuth + '/user/roleAssignment',
        method: 'post',
        data:data,
    })
}

//删除用户
export const deleteUser = (id) => {
    return Service({
        url: lotAuth + '/user/deleteUser/'+id,
        method: 'delete'
    })
}
//重置用户密码
export const resetPassword = (id) => {
    return Service({
        url: lotAuth + '/user/resetPss/'+id,
        method: 'get'
    })
}

//得到日志类型
export const getLogTypes = () => {
    return Service({
        url: '/gd-wms-log/log/queryLogType',
        method: 'get'
    })
}

//查询所有日志
export const getLogs = (str) => {
    return Service({
        url: '/gd-wms-log/log/queryPageLog?pageNum=1&pageSize=9999'+str,
        method: 'get',
    })
}

// ************************************************************************
// 查询文件
export const getFiles = (str) => {   
    return Service({
        url: '/file/file/queryFilePage?'+str,
        method: 'get',
    })
}

//删除文件
export const deleteFiles = (id) => { 
    return Service({
        url: '/file/file/deleteFile/'+id,
        method: 'delete'
    })
}
//下载文件
export const downloadFiles = (id) => {
    return Service({
        url: '/file/file/downloadFile/'+id,
        method: 'get'
    })
}
//显示文件
export const showFiles = (id) => {
    return Service({
        url: '/file/file/queryFileId/'+id,
        method: 'get'
    })
}
//添加 修改 文件
export const addFiles = (data) => {
    return Service({
        url: '/file/file/uploadFile',
        method: 'post',
        data:data,
    })
}
// 查询文件类型
export const getFileTypeList = (data) => {
    return Service({
        url: '/file/fileType/queryFileTypeList',
        method: 'get'
    })
}
// 查询文件标签
export const getFileTagList = (data) => {
    return Service({
        url: '/file/fileTag/queryTagList',
        method: 'get'
    })
}

//添加 修改文件类型
export const addFileType = (data) => {
    return Service({
        url: '/file/fileType/addFileType',
        method: 'post',
        data:data,
     })
}

//删除文件类型
export const deleteFileType = (id) => {
    return Service({
        url: '/file/fileType/deleteFileType/'+id,
        method: 'delete',
     }) 
}

//分页查询文件类型
export const queryFileType = (str) => {
    return Service({
        url:'/file/fileType/queryFileType?'+str,
        method:'get',
        
    })
}

//查询文件类型
export const queryFileTypeList = () => {
    return Service({
        url: '/file/fileType/queryFileTypeList',
        method: 'get',
})
}

//分页查询文件标签
export const queryTag = (str) => {
        return Service({
            url:'/file/fileTag/queryTag?'+str,
            method:'get',
            
        })
    }
    
//删除文件标签
export const deleteTag = (id) => {
    return Service({
       url: '/file/fileTag/deleteTag/'+id,
       method: 'delete',
    }) 
}

//添加 修改文件标签
export const addTag = (data) => {
    return Service({
        url: '/file/fileTag/addTag',
        method: 'post',
        data:data,
    })
}

//*************************************************************************** 
//分页查询
export const findBasePageList = (str) => {
    return Service({
        url:'gd-wms-base/base/findBasePageList?'+str,
        method:'get',
                    
    }) 
}  
//根据企业编号查询详情
export const findBaseById = (enterpriseNumber) => {
    return Service({
        url:'gd-wms-base/base/findBaseById/'+enterpriseNumber,
        method:'get',
                    
    })
} 

//修改供应商基础信息
export const updateSupplier = (data) => {
    return Service({
        url:'gd-wms-base/base/updateSupplier',
        method:'put',
        data:data
    })
}

//修改供应商基础信息
export const updateInviteStatus = (data) => {
    return Service({
        url:'gd-wms-base/base/updateInviteStatus',
        method:'put',
        data:data
    })
}

// 新增数据字典
export const add = (data) => {
    return Service({
        url:'gd-wms-base/Dictionary/add',
        method:'post',
        data:data
    })
}

//查询数据字典
export const find = () => {
    return Service({
        url:'gd-wms-base/Dictionary/find',
        method:'get',
    })
}
        
//删除数据字典
export const deleteDictionary = (id) => {
    return Service({
        url:'gd-wms-base/Dictionary/deleteDictionary/'+id,
        method:'delete',
    })
}
//修改数据字典
export const update = (data) => {
    return Service({
        url:'gd-wms-base/Dictionary/update',
        method:'put',
        data:data
    })
}

//***********************************************************************
//库房管理 查询储位树
export const findDepot = () =>{
    return Service({
        url:'gd-wms-base/depotManagement/findDepot',
        method:'get',
    })
}

//添加储位
export const addDepot = (data) =>{
    return Service({
        url:'gd-wms-base/depotManagement/addDepot',
        method:'post',
        data:data
    })
}

//删除储位
export const deleteDepot = (id) =>{
    return Service({
        url:'gd-wms-base/depotManagement/deleteDepot?id='+id,
        method:'delete',
    })
}

//修改储位
export const updateDepotManagement = (data) => {
    return Service({
        url:'gd-wms-base/depotManagement/updateDepotManagement',
        method:'put',
        data:data
    })
}

//修改流离货架详情
export const updateBaseFluentRack = (data) => {
    return Service({
        url:'gd-wms-base/depotManagement/updateBaseFluentRack',
        method:'put',
        data:data
    })
}

//查询流离货架详情
export const findBaseFluentRack = (storageLocationCod) => {
    return Service({
        url:'gd-wms-base/depotManagement/findBaseFluentRack?storageLocationCod='+storageLocationCod,
       method:'get',     
    })
}

//查询高位货架详情
export const findBaseHighLevel = (storageLocationCod) => {
    return Service({
        url:'gd-wms-base/depotManagement/findBaseHighLevel?storageLocationCod='+storageLocationCod,
        method:'get',     
    })
}

//修改高位货架详情
export const updateBaseHighLevel = (data) => {
    return Service({
        url:'gd-wms-base/depotManagement/updateBaseHighLevel',
        method:'put',
        data:data     
    })
}

//添加高位货架
export const addBaseHighLevel = (data) =>{
    return Service({
        url:'gd-wms-base/depotManagement/addBaseHighLevel',
        method:'post',
        data:data
    })
}

//**********************************

//新增周期计划
export const addJob = (data) =>{
    return Service({
        url:'gd-wms-timer/job/addJob',
        method:'post',
        data:data
    })
}

//根据id删除周期计划
export const deleteJob = (id) =>{
    return Service({
        url:'gd-wms-timer/job/deleteJob?id='+id,
        method:'delete',
    })
}

//周计划分组查询
export const findJobClassList = () => {
    return Service({
        url:'gd-wms-timer/job/findJobClassList',
        method:'get',     
    })
}

//分页查询周期计划
export const findJobList = (str) => {
    return Service({
        url:'gd-wms-timer/job/findJobList'+str,
        method:'get'
    }) 
}  

//修改周期计划
export const updateJob = (data) => {
    return Service({
        url:'gd-wms-timer/job/updateJob',
        method:'put',
        data:data     
    })
}

//打印所有流离货架
export const findBaseFluentRacks = () => {
    return Service({
        url:'gd-wms-base/depotManagement/findBaseFluentRacks',
        method:'get'
    }) 
}  

//查询所有货架
export const  findHighLevelRacks= () => {
    return Service({
        url:'gd-wms-base/depotManagement/findHighLevelRacks',
        method:'get',
    })
}

//根据id查找储位信息
export const findBaseDepotManagementById = (id) => {
    return Service({
        url:'gd-wms-base/depotManagement/findBaseDepotManagementById?id='+id,
        method:'get',     
    })
  }
  
  //根据父节点id查找所有子节点
  export const findBaseDepotManagementByParentId = (id) => {
    return Service({
        url:'gd-wms-base/depotManagement/findBaseDepotManagementByParentId?id='+id,
        method:'get',     
    })
  }
  
  //储位打印
//   export const printBaseDepotManagements = () => {
//     return Service({
//         url:'gd-wms-base/depotManagement/printBaseDepotManagements',
//         method:'get',     
//     })
//   }

/********** */
//工单物料查询
export const  queryFindPositionByBill= (str) => {
    return Service({
        url:'gd-wms-outbound/outBound/findWorkOrderMatter'+str,
        method:'get'
    })
}
//补料单物料查询
export const  queryFindFillBillMatter= (str) => {
    return Service({
        url:'gd-wms-outbound/outBound/findFillBillMatter'+str,
        method:'get'
    })
}
//工单查询
export const  queryOutWorkList= (str) => {
    return Service({
        url:'gd-wms-outbound/outBound/findWorkOrder'+str,
        method:'get'
    })
}

//补料单查询
export const  queryOutSupplementList= (str) => {
    return Service({
        url:'gd-wms-outbound/outBound/findFillBill'+str,
        method:'get'
    })
}
//工单分配
export const  queryWorkPicking= (data) => {
    return Service({
        url:'gd-wms-outbound/outBound/dispatchWorkOrder',
        method:'post',
        data:data
    })
}
//补料单分配
export const  queryFillBillPicking= (data) => {
    return Service({
        url:'gd-wms-outbound/outBound/dispatchFillBill',
        method:'post',
        data:data
    })
}
//流利架库存警告列表
export const  queryLLJWarning= (data) => {
    return Service({
        url:'gd-wms-cougny/alarm/findDeficitAlarmList'+data,
        method:'get'
    })
}
//调拨单查询
export const  queryDbdList= (data) => {
    return Service({
        url:'gd-wms-cougny/alarm/findTransferOrderList'+data,
        method:'get'
    })
}

//成品出库
export const  queryShipmentOut= (data) => {
    return Service({
        url:'gd-wms-outbound/outBound/dispatchSale',
        method:'post',
        data:data
    })
}
//成品批量查询
export const  queryManyShipment= (data) => {
    return Service({
        url:'gd-wms-outbound/outBound/findProductById',
        method:'post',
        data:data
    })
}
//成品出库列表
export const  queryShipment= (str) => {
    return Service({
        url:'gd-wms-outbound/outBound/findShipmentAllPageList'+str,
        method:'get',
    })
}
//成品id物料列表
export const  queryFindSaleMatter= (str) => {
    return Service({
        url:'gd-wms-outbound/outBound/findShipmentDetailsByShipmentNo'+str,
        method:'get',
    })
}
//销售调拨单列表
export const  queryFindTransfer= (str) => {
    return Service({
        url:'gd-wms-outbound/outBound/findTransferOrder2'+str,
        method:'get',
    })
}
//查询销售调拨单详情
export const  queryTransferInfo= (str) => {
    return Service({
        url:'gd-wms-outbound/outBound/findTransferInfo'+str,
        method:'get',
    })
}
//
export const  selectWorkOrderListAll= (data) => {
    return Service({
        url:'gd-wms-outbound/productionPreparation/selectWorkOrderListAll',
        method:'post',
        data
    })
}
///productionPreparation/selectWorkBomByWorkOrderId根据工单号查询工单物料信息WEB
export const  selectWorkBomByWorkOrderId= (data) => {
    return Service({
        url:'gd-wms-outbound/productionPreparation/selectWorkBomByWorkOrderId',
        method:'post',
        data
    })
}
///materialSupplement/selectWorkOrderMaterialSupplementAll条件查询补料所有工单信息WEB
export const  selectWorkOrderMaterialSupplementAll= (data) => {
    return Service({
        url:'gd-wms-outbound/materialSupplement/selectWorkOrderMaterialSupplementAll',
        method:'post',
        data
    })
}
///materialSupplement/selectWorkOrderMaterialSupplementByWorkOrderId根据补料工单号查询补料工单物料信息WEB
export const  selectWorkOrderMaterialSupplementByWorkOrderId= (data) => {
    return Service({
        url:'gd-wms-outbound/materialSupplement/selectWorkOrderMaterialSupplementByWorkOrderId',
        method:'post',
        data
    })
}
//新增流离货架
export const  addBaseFluentRack= (data) => {
    return Service({
        url:'gd-wms-base/depotManagement/addBaseFluentRack'+data,
        method:'post',
        data:data,
    })
}

//查询货架详情信息
export const printBaseDepotManagements = (str) => {
    return Service({
        url:'/gd-wms-base/depotManagement/printBaseDepotManagements?'+str,
        method:'get' 
    })
}

//批量打印  (带查询条件)
export const printByQuery = (str) => {
    return Service({
        url:'/gd-wms-base/depotManagement/printByQuery?'+str,
        method:'get' 
    })
}

//查询仓库 区域 货架
export const queryNextNode = (str) => {
    return Service({
        url: '/gd-wms-base/depotManagement/queryNextNode'+str,
        method: 'get',
    })
  }
///query/queryListAndResult 查询收货列表及质检结果
export const queryListAndResult = (data) => {
    return Service({
        url: '/gd-wms-base/query/queryListAndResult',
        method: 'post',
        data
    })
  }
///query/queryCount 数量查询
export const queryCount = (data) => {
    return Service({
        url: '/gd-wms-base/query/queryCount',
        method: 'post',
        data
    })
  }
//query/newQueryCount 新版数量查询
export const newQueryCount = (data) => {
    return Service({
        url: '/gd-wms-base/query/newQueryCount',
        method: 'post',
        data
    })
  }
  ///query/newExportExcel 新版数量查询导出Excel
export const newExportExcel = (data) => {
    return Service({
        url: '/gd-wms-base/query/newExportExcel',
        method: 'post',
        data,
        responseType:'blob'
    })
  }
///query/exportExcel 导出Excel
export const exportExcel = (data) => {
    return Service({
        url: '/gd-wms-base/query/exportExcel',
        method: 'post',
        data,
        responseType:'blob'
    })
  }
///query/excel 导出质检Excel
export const excelZj = (data) => {
    return Service({
        url: '/gd-wms-base/query/excel',
        method: 'post',
        data,
        responseType:'blob'
    })
  }